home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Developer Utilities / Installer 4.0.3 SDK / Script Examples / ResMerge [inrm] Example / myResMerge.r < prev    next >
Encoding:
Text File  |  1994-11-15  |  6.0 KB  |  193 lines  |  [TEXT/MPS ]

  1. //
  2. //    "myResMerge.r"
  3. //
  4. //        This Installer script source demonstrates use of ResMerge atoms.
  5. //        ResMerge atoms copy all the resources from the source file to
  6. //        the target file without the need for specifying any of the
  7. //        individual resource items. This atom type's main value is as
  8. //        a time saving device when writing installer scripts.
  9. //
  10. //        IMPORTANT SAFETY TIP : Both Custom Install options in this example 
  11. //        install several 'vers' resource items to the target file. These 
  12. //        "extra" version resources are basically harmless, but the first 
  13. //        option will install those resources to your active system file. 
  14. //        This is a weird ( but harmless ) thing to do and is intended only 
  15. //        as an example of how to add resource items to the active System file
  16. //        using ResMerge atoms.
  17. //        
  18. //        Three important things to remember about ResMerge atoms:
  19. //        1) They are always executed before resource atoms ( 'inra' )
  20. //            when the items they reference are contained on the same
  21. //            install disk.
  22. //        2) ResMerge atoms are not supported with InstaCompOne compression
  23. //            at this time ( 4.0.3 ).
  24. //        3) ResMerge atoms always overwrite the resource items in the
  25. //            target file.
  26. //
  27. //        NOTE: This example uses pre-4.0 method for creating Custom Install
  28. //        options. It is not intended as an example of how to use 4.0 User 
  29. //        Interface features. For more information on how to create the
  30. //        Easy and Custom Install options, etc. try the "Custom UI" example.
  31. //
  32. //
  33. //        mark young • 07/20/94
  34. //
  35. //        Copyright 1993-1994, Apple Computer, Inc., All Rights Reserved
  36. //
  37.  
  38. #include "InstallerTypes.r"
  39.  
  40.  
  41. // • packages
  42.  
  43. resource 'inpk' (100) {
  44.     format0 {
  45.         showsOnCustom,
  46.         removable,
  47.         forceRestart,    // always force restart when modifying system files
  48.         0,
  49.         0,
  50.         "ResMerge atom to active System file on target volume.",
  51.         {    
  52.         'inrm', 1000;
  53.         },
  54.     }
  55. };
  56.  
  57. resource 'inpk' (200) {
  58.     format0 {
  59.         showsOnCustom,
  60.         removable,
  61.         dontForceRestart,    // no need to reboot in this case
  62.         0,
  63.         0,
  64.         "ResMerge atom to TeachText on root of target volume.",
  65.         {    
  66.         'inrm', 2000;
  67.         },
  68.     }
  69. };
  70.  
  71.  
  72. // • ResMerge atoms
  73.  
  74. //     NOTE: For sake of simplicity both of the resource merge atoms
  75. //    defined below use the same source file to store the resource
  76. //    items to be installed. A more common usage of the resMerge atom 
  77. //    ( 'inrm' ) is to have unique source files ( containing different 
  78. //    resource items ) for each resMerge atom. To do this, just define 
  79. //    a unique source spec ( 'infs' ) for each resMerge atom and specify 
  80. //    the ID for the source spec for each resMerge atom.
  81.  
  82. // ResMerge atom for source >> active System file
  83. resource 'inrm' (1000) {
  84.     format0 {
  85.         0,
  86.         10001,        // target spec for active System file
  87.         10000,         // shared source spec for ResMerge atom
  88.         ""
  89.     }
  90. };
  91.  
  92. // ResMerge atom for source >> TeachText on root folder of target volume
  93. resource 'inrm' (2000) {
  94.     format0 {
  95.         0,
  96.         20001,        // target spec for TeachText on root folder of target volume
  97.         10000,         // shared source spec for ResMerge atom
  98.         ""
  99.     }
  100. };
  101.  
  102.  
  103. // • file specs
  104.  
  105. // target file spec for active System file on target volume
  106. resource 'intf' (10001) {
  107.     format1 {
  108.         noSearchForFile,                 // use default search path
  109.         
  110.         TypeCrMustMatch,                 // If this is set to TypeCrMustMatch
  111.                                         // then a file with a different type
  112.                                         // and creator than those specified
  113.                                         // below will not be updated.
  114.                                         // If this is set to TypeCrNeedNotMatch
  115.                                         // then type and creator of an existing
  116.                                         // target file are ignored.
  117.         
  118.         // The Type and Creator fields will be used to set the
  119.         // file's Type and Creator when a new file is created. 
  120.         // NOTE: It's never a good idea to create a bogus
  121.         // System file with just a couple of resources. A better
  122.         // way to handle installation to a System file is to use
  123.         // a resource atom ('inra'), because it allows you to
  124.         // require the target file to exist before installing
  125.         // any resource items to the target file.
  126.         'zsys',                         // TYPE for new file
  127.         'MACS',                         // CREATOR for new file
  128.         
  129.         0,                                 // finder attribute flags
  130.                                         // filled by ScriptCheck is value is 0
  131.         
  132.         1,                                  // creation date for new file
  133.         1,                                  // modification date for new file
  134.                                         // NOTE: DATE values are filled
  135.                                         // by ScriptCheck if the value is 1
  136.                                             
  137.         0,                                 // search proc ID ( 'insp' ), none used
  138.         
  139.         "special-macs:System"            // path to target file
  140.         }
  141.     };
  142.  
  143. // target file spec for TeachText application on root of target volume
  144. // NOTE: When a target spec is called from within a resource atom of
  145. // any kind ( 'inra', 'inrm', 'inr#' ), the type, creator, dates and
  146. // Finder attributes fields will only apply when creating a new file.
  147. resource 'intf' (20001) {
  148.     format1 {
  149.         noSearchForFile,                 // use default search path
  150.         
  151.         TypeCrMustMatch,                 // If this is set to TypeCrMustMatch
  152.                                         // then a file with a different type
  153.                                         // and creator than those specified
  154.                                         // below will not be updated.
  155.                                         // If this is set to TypeCrNeedNotMatch
  156.                                         // then type and creator of an existing
  157.                                         // target file are ignored.
  158.         
  159.         // The Type and Creator fields will be used to set the
  160.         // file's Type and Creator when a new file is created. 
  161.         'APPL',                         // TYPE for new file
  162.         'ttxt',                         // CREATOR for new file
  163.         
  164.         0,                                 // finder attribute flags
  165.                                         // filled by ScriptCheck is value is 0
  166.         
  167.         1,                                  // creation date for new file
  168.         1,                                  // modification date for new file
  169.                                         // NOTE: DATE values are filled
  170.                                         // by ScriptCheck if the value is 1
  171.                                             
  172.         0,                                 // search proc ID ( 'insp' ), none used
  173.         
  174.         ":TeachText"            // path to target file
  175.         }
  176.     };
  177.  
  178. // shared source file spec for ResMerge source file
  179. resource 'infs' (10000) {
  180.     'rsrc',                        // TYPE for source file
  181.     'RSED',                        // CREATOR for source file
  182.     
  183.     0x1,                        // creation DATE for source file
  184.     
  185.                                 // - ScriptCheck will fill in date
  186.                                 // fields that have a value of 0x1
  187.                                 
  188.     noSearchForFile,            // IGNORED in Installer 4.0.x
  189.     TypeCrMustMatch,            // TYPE, CREATOR must match file on install disk
  190.     "Disk 1:ResMergeSource.rsrc"    // path to target file
  191. };
  192.  
  193.